<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        #box {
            width: 360px;
            border: 1px solid #ccc;
            margin: 100px auto;
            overflow: hidden;
        }

        #box img {

            vertical-align: middle;
        }

        #box ul {
            overflow: hidden;
            border-top: 1px solid #ccc;
        }

        #box li {
            float: left;
        }

        #itemList img {
            width: 70px;
            height: 70px;
        }
    </style>
</head>

<body>
    <div id="box">
        <img src="images/01.jpg" id="bigImg" alt="" />
        <ul id="itemList">
            <li><img src="images/01.jpg" alt="" /></li>
            <li><img src="images/02.jpg" alt="" /></li>
            <li><img src="images/03.jpg" alt="" /></li>
            <li><img src="images/04.jpg" alt="" /></li>
            <li><img src="images/05.jpg" alt="" /></li>
        </ul>
    </div>
    <script>
        // var bigImg = document.getElementById('binImg');
        // var itemList = document.getElementById('itemList');
        // var img = document.querySelectorAll('#itemList img');

        // for (var i = 0; i < img.length; i++) {
        //     var imgs = img[i];
        //     imgs.onclick = function () {
        //         bigImg.src = this.src;
        //     }
        // }
        var bigImg = document.getElementById("bigImg");
        var itemList = document.getElementById("itemList");
        var imgs = itemList.getElementsByTagName("img");
        for (var i = 0; i < imgs.length; i++) {
            var img = imgs[i];
            img.onclick = function () {
                bigImg.src = this.src;
            }
        }
    </script>
</body>

</html>